﻿#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->pushButton->setText(QStringLiteral("数据采集"));
    ui->pushButton_2->setText(QStringLiteral("数据处理"));
    ui->pushButton_3->setText(QStringLiteral("输出报告"));
    ui->pushButton_4->setText(QStringLiteral("数据详情"));
    ui->pushButton_5->setText(QStringLiteral("最终结果"));
    ui->pushButton_6->setText(QStringLiteral("输入组数"));
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
    view.getStatusOfCollect();
    ui->pushButton->setText(QStringLiteral("数据采集完成"));
}

void MainWindow::on_pushButton_2_clicked()
{
    view.getStatusOfDeal();
    ui->pushButton_2->setText(QStringLiteral("数据处理完成"));
}

void MainWindow::on_pushButton_3_clicked()
{
    view.signal="输出报告";
    view.outputWithSignal();
    ui->pushButton_3->setText(QStringLiteral("输出报告完成"));
}

void MainWindow::on_pushButton_4_clicked()
{
    ui->pushButton_4->setText(QStringLiteral("请输入组数："));
}

void MainWindow::on_pushButton_5_clicked()
{
    ui->textBrowser_2->append(QString::number(view.controller.aveOfAll));
}

void MainWindow::on_pushButton_6_clicked()
{
    int num;
    ui->textBrowser->clear();
    num=ui->lineEdit->text().toInt();
    ui->textBrowser->append(QStringLiteral("数据=\n")+QString::number(view.controller.array[num][0])+"\t"+QString::number(view.controller.array[num][1])+"\t"+QString::number(view.controller.array[num][2])+"\t"+QString::number(view.controller.array[num][3])+"\t"+QString::number(view.controller.array[num][4])+"\n"+QStringLiteral("平均值=\n")+QString::number(view.controller.ave[num]));
}
